package com.shouer.doc.common.util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by ZXL on 2016/12/7.
 */

public class ThreadPoolUtil {

    private ExecutorService cachedThreadPool;
    private static ThreadPoolUtil instance;

    public ThreadPoolUtil() {
        cachedThreadPool= Executors.newCachedThreadPool();
    }

    public static ThreadPoolUtil getInstance() {
        if (instance == null) {
            synchronized (ThreadPoolUtil.class) {
                if (instance == null) {
                    instance = new ThreadPoolUtil();
                }
            }
        }
        return instance;
    }

    public ExecutorService getCachedThreadPool() {
        return cachedThreadPool;
    }
}
